From 0587ab87dda23cc3168b4e84e8dbd7fd164d7205 Mon Sep 17 00:00:00 2001 From: Xue Fuqiao Date: Thu, 27 Feb 2014 19:59:35 +0800 Subject: [PATCH] Some doc about electric-indent-mode. * doc/lispref/text.texi (Margins): Fix the description of RET and `C-j'. * doc/emacs/programs.texi (Basic Indent): (Other C Commands): Fix the description of RET and `C-j'. * doc/emacs/indent.texi (Indentation Commands): Move the description of `C-j' from here... * doc/emacs/basic.texi (Inserting Text): ... to here. --- doc/emacs/ChangeLog | 9 +++++++++ doc/emacs/basic.texi | 14 ++++++++++---- doc/emacs/indent.texi | 5 ----- doc/emacs/programs.texi | 24 +++++++++++------------- doc/lispref/ChangeLog | 2 ++ doc/lispref/text.texi | 2 +- doc/misc/cc-mode.texi | 2 ++ doc/misc/octave-mode.texi | 1 + doc/misc/vip.texi | 1 + etc/NEWS | 1 + 10 files changed, 38 insertions(+), 23 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index f3d6c3b67bc..4db292c2f87 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,12 @@ +2014-02-27 Xue Fuqiao + + * programs.texi (Basic Indent): + (Other C Commands): Fix the description of RET and `C-j'. + + * indent.texi (Indentation Commands): Move the description of + `C-j' from here... + * basic.texi (Inserting Text): ... to here. + 2014-02-25 Glenn Morris * custom.texi (Terminal Init): diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index 27a8ba9438e..f2ec11c2c1e 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -40,14 +40,20 @@ forward, so that point remains just after the inserted text. @xref{Point}. @kindex RET +@kindex C-j @cindex newline +@findex electric-indent-just-newline To end a line and start a new one, type @key{RET} (@code{newline}). (The @key{RET} key may be labeled @key{Return} or @key{Enter} on your keyboard, but we refer to it as @key{RET} in this manual.) This -command inserts a newline character into the buffer. If point is at -the end of the line, the effect is to create a new blank line after -it; if point is in the middle of a line, the line is split at that -position. +command inserts a newline character into the buffer, then indent +(@pxref{Indentation}) accroding to major mode. If point is at the end +of the line, the effect is to create a new blank line after it and +indent the new line; if point is in the middle of a line, the line is +split at that position. To turn off the auto-indentation, you can +either desable Electric Indent mode (@pxref{Indent Convenience}) or +type @kbd{C-j}, which inserts just a newline, without any +auto-indentation. As we explain later in this manual, you can change the way Emacs handles text insertion by turning on @dfn{minor modes}. For instance, diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi index 9aec6202de6..78e2e925e41 100644 --- a/doc/emacs/indent.texi +++ b/doc/emacs/indent.texi @@ -64,11 +64,6 @@ Emacs provides a variety of commands to perform indentation in other ways. @table @kbd -@item C-j -@kindex C-j -@findex newline-and-indent -Perform @key{RET} followed by @key{TAB} (@code{newline-and-indent}). - @item C-M-o @kindex C-M-o @findex split-line diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 26e9539d750..4a6da9e4fd6 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -366,9 +366,9 @@ which reformats Lisp objects with nice-looking indentation. @table @kbd @item @key{TAB} Adjust indentation of current line (@code{indent-for-tab-command}). -@item C-j +@item @key{RET} Insert a newline, then adjust indentation of following line -(@code{newline-and-indent}). +(@code{newline}). @end table @kindex TAB @r{(programming modes)} @@ -382,12 +382,9 @@ the current line, based on the indentation and syntactic content of the preceding lines; if the region is active, @key{TAB} indents each line within the region, not just the current line. -@kindex C-j @r{(indenting source code)} -@findex newline-and-indent - The command @kbd{C-j} (@code{newline-and-indent}), which was -documented in @ref{Indentation Commands}, does the same as @key{RET} -followed by @key{TAB}: it inserts a new line, then adjusts the line's -indentation. + The command @key{RET} (@code{newline}), which was documented in +@ref{Inserting Text}, does the same as @key{C-j} followed by +@key{TAB}: it inserts a new line, then adjusts the line's indentation. When indenting a line that starts within a parenthetical grouping, Emacs usually places the start of the line under the preceding line @@ -1681,18 +1678,18 @@ hungry-delete feature is enabled. @findex c-context-line-break This command inserts a line break and indents the new line in a manner appropriate to the context. In normal code, it does the work of -@kbd{C-j} (@code{newline-and-indent}), in a C preprocessor line it -additionally inserts a @samp{\} at the line break, and within comments -it's like @kbd{M-j} (@code{c-indent-new-comment-line}). +@key{RET} (@code{newline}), in a C preprocessor line it additionally +inserts a @samp{\} at the line break, and within comments it's like +@kbd{M-j} (@code{c-indent-new-comment-line}). @code{c-context-line-break} isn't bound to a key by default, but it needs a binding to be useful. The following code will bind it to -@kbd{C-j}. We use @code{c-initialization-hook} here to make sure +@kbd{RET}. We use @code{c-initialization-hook} here to make sure the keymap is loaded before we try to change it. @example (defun my-bind-clb () - (define-key c-mode-base-map "\C-j" + (define-key c-mode-base-map "\C-m" 'c-context-line-break)) (add-hook 'c-initialization-hook 'my-bind-clb) @end example @@ -1812,6 +1809,7 @@ defines these commands: @table @kbd @item @key{TAB} @code{tab-to-tab-stop}. +@c FIXME: Maybe this should be consistent with other programming modes. @item C-j Insert a newline and then indent using @code{tab-to-tab-stop}. @item : diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 59e12097f2d..1357946c7c4 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,5 +1,7 @@ 2014-02-27 Xue Fuqiao + * text.texi (Margins): Fix the description of RET and `C-j'. + * frames.texi (Multiple Terminals): Document `display-monitor-attributes-list' and `display-monitor-attributes'. (Display Feature Testing): Add some notes about multi-monitor. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 18701465d0f..9df6cf61e06 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -1717,7 +1717,7 @@ is value of @code{indent-line-function} in Paragraph-Indent Text mode. @defopt left-margin This variable specifies the base left margin column. In Fundamental -mode, @kbd{C-j} indents to this column. This variable automatically +mode, @kbd{RET} indents to this column. This variable automatically becomes buffer-local when set in any fashion. @end defopt diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 2d916b8416c..c7f51b4dcbe 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -751,6 +751,7 @@ very useful in this case. @end itemize @table @asis +@c FIXME: This should be `electric-indent-just-newline' since GNU Emacs 24.4. @item @kbd{C-j} (@code{newline-and-indent}) @kindex C-j @findex newline-and-indent @@ -7054,6 +7055,7 @@ Set the variable @code{c-basic-offset}. @xref{Getting Started}. @kindex RET @kindex C-j @emph{Why doesn't the @kbd{RET} key indent the new line?} +@c FIXME: `electric-indent-mode' is enabled by default in GNU Emacs 24.4. Emacs's convention is that @kbd{RET} just adds a newline, and that @kbd{C-j} adds a newline and indents it. You can make @kbd{RET} do this diff --git a/doc/misc/octave-mode.texi b/doc/misc/octave-mode.texi index 305a54800c1..6dde042a315 100644 --- a/doc/misc/octave-mode.texi +++ b/doc/misc/octave-mode.texi @@ -148,6 +148,7 @@ and return values which have to be entered without parentheses in one of your Emacs startup files. @end table +@c FIXME: `electric-indent-mode' is enabled by default in GNU Emacs 24.4. A common problem is that the @key{RET} key does @emph{not} indent the line to where the new text should go after inserting the newline. This is because the standard Emacs convention is that @key{RET} (aka diff --git a/doc/misc/vip.texi b/doc/misc/vip.texi index 90dc3cd8dec..95f829d14ed 100644 --- a/doc/misc/vip.texi +++ b/doc/misc/vip.texi @@ -1568,6 +1568,7 @@ Set mark and push previous mark on mark ring (@code{set-mark-command}). @kindex 011 TAB (@code{indent-for-tab-command}) Indent line for current major mode (@code{indent-for-tab-command}). @item C-j +@c FIXME: This should be `electric-indent-just-newline' since GNU Emacs 24.4. @kindex 012 @kbd{C-j} (@code{newline-and-indent}) Insert a newline, then indent according to mode (@code{newline-and-indent}). @item C-k diff --git a/etc/NEWS b/etc/NEWS index 3091e893297..fd2f380944a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -128,6 +128,7 @@ POSIX ACL interfaces. ** Multi-monitor support has been added. ++++ *** New functions `display-monitor-attributes-list' and `frame-monitor-attributes' can be used to obtain information about each physical monitor on multi-monitor setups. -- 2.30.2